package Base.ArrayTset;

import java.util.Arrays;

/*
 * @author 枫城
 * @createTime 2022/8/8 14:34
 * @desc 冒泡排序
 */
public class BubbleSortTest {
    public static void main(String[] args) {
       BubbleSort();
    }
    // 冒泡排序
    public static void BubbleSort(){
        int[] arr = new int[]{15, -16, 16, -23, 45, 12, 45,32, 78, -12, 99};
        for (int i = 0; i < arr.length-1; i++) {
            for (int j = 0; j < arr.length-i-1; j++) {
                if (arr[j] <= arr[j+1]){
                    continue;
                }else {
                    int temp = arr[j];
                    arr[j] = arr[j+1];
                    arr[j+1] = temp;
                }
            }
        }
        System.out.println(Arrays.toString(arr));
    }

}
